package com.kevin.demo.springbootdemo2.service.impl;

import com.kevin.demo.springbootdemo2.manager.UserManager;
import com.kevin.demo.springbootdemo2.po.User;
import com.kevin.demo.springbootdemo2.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author kevin
 * @version： UserServiceImpl.java v 1.0, 2020年05月20日 17:09
 * @Description
 **/
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserManager userManager;

    /**
     * 查询用户列表
     *
     * @return
     */
    @Override
    public List<User> queryUsers() {
        return userManager.queryUsers();
    }

    /**
     * 删除用户
     *
     * @param id
     * @return
     */
    @Override
    public boolean deleteUser(int id) {
        int i = userManager.deleteUser(id);
        if (i > 0) {
            this.queryUsers();
            return true;
        }
        return false;
    }
}
